package com.joysuch.wwyt.workflow.repository;

import com.joysuch.wwyt.workflow.entity.WorkFlowFormTemplate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface WorkFlowFormTemplateDao extends JpaRepository<WorkFlowFormTemplate, Long>{


    public Page<WorkFlowFormTemplate> findAll(Specification<WorkFlowFormTemplate> spec, Pageable pageable);

    @Query(value = "select count(*) from  WWYT_WORKFLOW_FORM_TEMPLATE where type=:type ", nativeQuery = true)
    Integer findCountByType(@Param("type")  Long type);

    WorkFlowFormTemplate findFirstByNameAndType(String name, Long type);

}
